package com.springboot.frame;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 启动类
 */
@SpringBootApplication
public class SpringBootVersionApplication {

    public static void main(String[] args) {
        SpringApplication.run(SpringBootVersionApplication.class, args);
    }

    @RequestMapping("api/{version}/user")
    @RestController
    class UserV1Controller {

        @GetMapping("/test")
        public String test() {
            return "version1";
        }

        @GetMapping("/extend")
        public String extendTest() {
            return "user v1 extend";
        }
    }

    @RequestMapping("api/{version}/user")
    @RestController
    @ApiVersion(2)
    class UserV2Controller {
        @GetMapping("/test")
        public String test() {
            return "user v2 test";
        }
    }
}
